package fun.lifepoem.demo.config;

import fun.lifepoem.demo.filter.HeaderFilter;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author Yiwyn
 * @create 2022/12/4 2:00
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(headerFilter()).
                addPathPatterns("/**").
                order(-10);
    }

    public HeaderFilter headerFilter() {
        return new HeaderFilter();
    }
}
